home *** CD-ROM | disk | FTP | other *** search
/ Workbench Design / WB Collection.iso / workbench werkzeuge / icon tools / forceicon / source / error.h < prev    next >
C/C++ Source or Header  |  1996-04-07  |  5KB  |  198 lines

  1. /*
  2. Auto:        smake ForceIcon
  3. */
  4.  
  5.  
  6.  
  7. /* $Revision Header built automatically *************** (do not edit) ************
  8. **
  9. ** © Copyright by GuntherSoft
  10. **
  11. ** File             : SnakeSYS:CPrgs/Utils/ForceIcon/Error.c
  12. ** Created on       : Saturday, 23.10.93 14:30:06
  13. ** Created by       : Kai Iske
  14. ** Current revision : V1.0
  15. **
  16. **
  17. ** Purpose
  18. ** -------
  19. **   - Error-Handling for ForceIcon
  20. **
  21. ** Revision V1.0
  22. ** --------------
  23. ** created on Saturday, 23.10.93 14:30:06  by  Kai Iske.   LogMessage :
  24. **     --- Initial release ---
  25. **
  26. *********************************************************************************/
  27.  
  28.  
  29.  
  30.  
  31. /**********************************************************************/
  32. /*                          Internal errors                           */
  33. /**********************************************************************/
  34. static char *InternalErrs[] =
  35. {
  36.     "%s verion %ld could not be opened.",
  37.  
  38.     "Sorry, out of memory",
  39.  
  40.     "Sorry, not all entries from DOS-List\ncould be collected.",
  41.  
  42. #ifdef PREFSRUN
  43.     "ForceIcon v%ld.%ld, (%s)\n"
  44.         "by Kai Iske, GiftWare\n\n"
  45.         "Reach me under\n"
  46.         "   Kai Iske, Brucknerstrasse 18, 63452 Hanau, Germany\n"
  47.         "                  Tel.: +49-(0)6181-850181\n"
  48.         "or electronically\n"
  49.         "   Internet:   iske@informatik.uni-frankfurt.de\n"
  50.         "   CompuServe: Kai Iske, 100524,1201\n"
  51.         "   Fido:       Kai Iske, 2:244/6302.11\n"
  52.         "   ZNet:       KAI@SWEET.RHEIN-MAIN.DE\n\n"
  53.         "ForceIcon (Prefs) is a MUI application; MUI © Stefan Stuntz",
  54.  
  55.     "Volume %s\nhas already been selected.",
  56.  
  57.     "",
  58.  
  59.     "",
  60. #else
  61.     "",
  62.  
  63.     "",
  64.  
  65.     "Someone else has patched %s vector.\n"
  66.     "Please remove the other program(s) first.\n"
  67.     "Can not quit yet. Continuing program.",
  68.  
  69.     "ForceIcon snapped icon position.\n"
  70.     "Use Prefs Program to save permanently.",
  71. #endif
  72.  
  73. #ifdef PREFSRUN
  74.     "Application object for windows\n"
  75.     "could not be created.",
  76.  
  77.     "Old (not AppIcons supporting)\n"
  78.     "ForceIcon server removed.\n"
  79.     "Please launch new version.",
  80.  
  81.     ""
  82.  
  83. #else
  84.     "",
  85.  
  86.     "",
  87.  
  88.     "Warning: %ld AppIcons are still patched\n"
  89.     "If you select OK, memory allocated by these\n"
  90.     "icons won`t be returned until you reboot.\n"
  91.     "Select CANCEL to keep ForceIcon running."
  92. #endif
  93. };
  94.  
  95.  
  96.  
  97. /**********************************************************************/
  98. /*                             IFF-Errors                             */
  99. /**********************************************************************/
  100. static char *IFFErrs[] =
  101. {
  102.     "IFF-Error\nEnd of file reached before completing parse.",
  103.     "IFF-Error\nAn IFF-Chunk could not be read.",
  104.     "IFF-Error\nChunk-Contents didn`t reside at expected position.",
  105.     "IFF-Error\nInternal memory could not be allocated.",
  106.     "IFF-Error\nError while reading from file.\nFile could probably not be opened.",
  107.     "IFF-Error\nError while writing to file.\nFile could probably not be opened.",
  108.     "IFF-Error\nError while seeking through file.\n%s",
  109.     "IFF-Error\nData within file corrupt.\n%s",
  110.     "IFF-Error\nSyntax error within file.\n%s",
  111.     "IFF-Error\n%s\nis not an IFF file."
  112. };
  113.  
  114.  
  115.  
  116.  
  117.  
  118. /**********************************************************************/
  119. /*                          Display an error                          */
  120. /**********************************************************************/
  121. static BOOL __stdargs DisplayError(LONG ErrCode, ULONG Arg1, ...)
  122. {
  123.     struct EasyStruct MyRequest =
  124.     {
  125.         sizeof(struct EasyStruct),
  126.         0,
  127.         NULL,
  128.         NULL,
  129.         NULL
  130.     };
  131.  
  132.     if(!IntuitionBase)
  133.         return(TRUE);
  134.  
  135.         // Set header for Requester
  136.  
  137.     MyRequest.es_Title        = "ForceIcon";
  138.  
  139.     if(ErrCode != ERR_APPICONSPATCHED)
  140.         MyRequest.es_GadgetFormat    = "Ok";
  141.     else
  142.         MyRequest.es_GadgetFormat    = "Ok|Cancel";
  143.  
  144.  
  145.         // Set correct text
  146.  
  147.     if((ErrCode >= 0) && (ErrCode < 200))
  148.     {
  149.         MyRequest.es_TextFormat = InternalErrs[ErrCode];
  150. #ifdef PREFSRUN
  151.         if(MainWindow && AppObject && MUIMasterBase)
  152.             MUI_RequestA(AppObject, MainWindow, 0, NULL, "*Ok", MyRequest.es_TextFormat, &Arg1);
  153.         else
  154.             EasyRequestArgs(NULL, &MyRequest, NULL, &Arg1);
  155.  
  156.         return(0);
  157. #else
  158.         return((BOOL)EasyRequestArgs(NULL, &MyRequest, NULL, &Arg1));
  159. #endif
  160.     }
  161.  
  162.     else if((ErrCode >= 200) && (ErrCode < 226))
  163.     {
  164.         char    Buffer[128];
  165.  
  166.         Fault(ErrCode, NULL, Buffer, 128);
  167.  
  168.         MyRequest.es_TextFormat = "DOS-Error %ld\n%s";
  169.  
  170. #ifdef PREFSRUN
  171.         if(MainWindow && AppObject && MUIMasterBase)
  172.             MUI_RequestA(AppObject, MainWindow, 0, NULL, "*Ok", MyRequest.es_TextFormat, &Arg1);
  173.         else
  174.             EasyRequestArgs(NULL, &MyRequest, NULL, &Arg1);
  175.  
  176.         return(0);
  177. #else
  178.         return((BOOL)EasyRequestArgs(NULL, &MyRequest, NULL, &Arg1));
  179. #endif
  180.     }
  181.  
  182.     else if(ErrCode < 0)
  183.     {
  184.         MyRequest.es_TextFormat = IFFErrs[((-ErrCode) - 1)];
  185.  
  186. #ifdef PREFSRUN
  187.         if(MainWindow && AppObject && MUIMasterBase)
  188.             MUI_RequestA(AppObject, MainWindow, 0, NULL, "*Ok", MyRequest.es_TextFormat, &Arg1);
  189.         else
  190.             EasyRequestArgs(NULL, &MyRequest, NULL, &Arg1);
  191.  
  192.         return(0);
  193. #else
  194.         return((BOOL)EasyRequestArgs(NULL, &MyRequest, NULL, &Arg1));
  195. #endif
  196.     }
  197. }
  198.